package com.xufeng.demo.test;

import lombok.Data;

import java.util.function.BiConsumer;
import java.util.function.Supplier;

/**
 * 使用函数式编程实现构造器模式
 * 使用供应器和BiConsumer
 *
 * @author xufeng
 * @since 21.07.2023
 */
public class main1 {

    Supplier<Person> getPerson = Person::new;

    BiConsumer<Person, String> changePersonName = Person::setName;

    @Data
    private static class Person {
        private String name;

    }


    public static void main(String[] args) {
        main1 m = new main1();
        Person a = m.getPerson.get();
        m.changePersonName.accept(a, "Gandalf");

    }


}
